<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>LibQQt: QCPLayer Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">LibQQt
   &#160;<span id="projectnumber">v3.1</span>
   </div>
   <div id="projectbrief">开源、跨平台Qt应用程序框架中间件</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pro-methods">Protected Member Functions</a> &#124;
<a href="#pro-attribs">Protected Attributes</a> &#124;
<a href="#friends">Friends</a> &#124;
<a href="class_q_c_p_layer-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">QCPLayer Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>A layer that may contain objects, to control the rendering order.  
 <a href="class_q_c_p_layer.html#details">More...</a></p>
<div class="dynheader">
Inheritance diagram for QCPLayer:</div>
<div class="dyncontent">
 <div class="center">
  <img src="class_q_c_p_layer.png" usemap="#QCPLayer_map" alt=""/>
  <map id="QCPLayer_map" name="QCPLayer_map">
</map>
 </div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a5d0657fc86d624e5efbe930ef21af718"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_q_c_p_layer.html#a5d0657fc86d624e5efbe930ef21af718">QCPLayer</a> (<a class="el" href="class_q_custom_plot.html">QCustomPlot</a> *parentPlot, const QString &amp;layerName)</td></tr>
<tr class="separator:a5d0657fc86d624e5efbe930ef21af718"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5520019787482e13857ebe631c27c3fa"><td class="memItemLeft" align="right" valign="top"><a id="a5520019787482e13857ebe631c27c3fa"></a>
<a class="el" href="class_q_custom_plot.html">QCustomPlot</a> *&#160;</td><td class="memItemRight" valign="bottom"><b>parentPlot</b> () const</td></tr>
<tr class="separator:a5520019787482e13857ebe631c27c3fa"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a37806f662b50b588fb1029a14fc5ef50"><td class="memItemLeft" align="right" valign="top"><a id="a37806f662b50b588fb1029a14fc5ef50"></a>
QString&#160;</td><td class="memItemRight" valign="bottom"><b>name</b> () const</td></tr>
<tr class="separator:a37806f662b50b588fb1029a14fc5ef50"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad322905c4700dcc7ceba63e011c730d2"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_q_c_p_layer.html#ad322905c4700dcc7ceba63e011c730d2">index</a> () const</td></tr>
<tr class="separator:ad322905c4700dcc7ceba63e011c730d2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a183b90941fc78f0b136edd77c5fb6966"><td class="memItemLeft" align="right" valign="top">QList&lt; <a class="el" href="class_q_c_p_layerable.html">QCPLayerable</a> * &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_q_c_p_layer.html#a183b90941fc78f0b136edd77c5fb6966">children</a> () const</td></tr>
<tr class="separator:a183b90941fc78f0b136edd77c5fb6966"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad1cc2d6b32d2abb33c7f449b964e068c"><td class="memItemLeft" align="right" valign="top"><a id="ad1cc2d6b32d2abb33c7f449b964e068c"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><b>visible</b> () const</td></tr>
<tr class="separator:ad1cc2d6b32d2abb33c7f449b964e068c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac07671f74edf6884b51a82afb2c19516"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_q_c_p_layer.html#ac07671f74edf6884b51a82afb2c19516">setVisible</a> (bool visible)</td></tr>
<tr class="separator:ac07671f74edf6884b51a82afb2c19516"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-methods"></a>
Protected Member Functions</h2></td></tr>
<tr class="memitem:a57ce5e49364aa9122276d5df3b4a0ddc"><td class="memItemLeft" align="right" valign="top"><a id="a57ce5e49364aa9122276d5df3b4a0ddc"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>addChild</b> (<a class="el" href="class_q_c_p_layerable.html">QCPLayerable</a> *layerable, bool prepend)</td></tr>
<tr class="separator:a57ce5e49364aa9122276d5df3b4a0ddc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac2f64ac7761650582d968d86670ef362"><td class="memItemLeft" align="right" valign="top"><a id="ac2f64ac7761650582d968d86670ef362"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>removeChild</b> (<a class="el" href="class_q_c_p_layerable.html">QCPLayerable</a> *layerable)</td></tr>
<tr class="separator:ac2f64ac7761650582d968d86670ef362"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-attribs"></a>
Protected Attributes</h2></td></tr>
<tr class="memitem:a2f3374a7884bf403720cd1cf6f7ad1bb"><td class="memItemLeft" align="right" valign="top"><a id="a2f3374a7884bf403720cd1cf6f7ad1bb"></a>
<a class="el" href="class_q_custom_plot.html">QCustomPlot</a> *&#160;</td><td class="memItemRight" valign="bottom"><b>mParentPlot</b></td></tr>
<tr class="separator:a2f3374a7884bf403720cd1cf6f7ad1bb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a91e6298183cb4b9dfd4efdfaf1ecc220"><td class="memItemLeft" align="right" valign="top"><a id="a91e6298183cb4b9dfd4efdfaf1ecc220"></a>
QString&#160;</td><td class="memItemRight" valign="bottom"><b>mName</b></td></tr>
<tr class="separator:a91e6298183cb4b9dfd4efdfaf1ecc220"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a122088bcab6cec76a52b75ce8606605b"><td class="memItemLeft" align="right" valign="top"><a id="a122088bcab6cec76a52b75ce8606605b"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><b>mIndex</b></td></tr>
<tr class="separator:a122088bcab6cec76a52b75ce8606605b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a704aa71bba469383c3a3c598c1ec0d28"><td class="memItemLeft" align="right" valign="top"><a id="a704aa71bba469383c3a3c598c1ec0d28"></a>
QList&lt; <a class="el" href="class_q_c_p_layerable.html">QCPLayerable</a> * &gt;&#160;</td><td class="memItemRight" valign="bottom"><b>mChildren</b></td></tr>
<tr class="separator:a704aa71bba469383c3a3c598c1ec0d28"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a264950deb08e589460c126c895a1e2b5"><td class="memItemLeft" align="right" valign="top"><a id="a264950deb08e589460c126c895a1e2b5"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><b>mVisible</b></td></tr>
<tr class="separator:a264950deb08e589460c126c895a1e2b5"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="friends"></a>
Friends</h2></td></tr>
<tr class="memitem:a1cdf9df76adcfae45261690aa0ca2198"><td class="memItemLeft" align="right" valign="top"><a id="a1cdf9df76adcfae45261690aa0ca2198"></a>
class&#160;</td><td class="memItemRight" valign="bottom"><b>QCustomPlot</b></td></tr>
<tr class="separator:a1cdf9df76adcfae45261690aa0ca2198"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad655f55cccf49ba14d5172ec517e07ae"><td class="memItemLeft" align="right" valign="top"><a id="ad655f55cccf49ba14d5172ec517e07ae"></a>
class&#160;</td><td class="memItemRight" valign="bottom"><b>QCPLayerable</b></td></tr>
<tr class="separator:ad655f55cccf49ba14d5172ec517e07ae"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>A layer that may contain objects, to control the rendering order. </p>
<p>The Layering system of <a class="el" href="class_q_custom_plot.html" title="The central class of the library. This is the QWidget which displays the plot and interacts with the ...">QCustomPlot</a> is the mechanism to control the rendering order of the elements inside the plot.</p>
<p>It is based on the two classes <a class="el" href="class_q_c_p_layer.html" title="A layer that may contain objects, to control the rendering order. ">QCPLayer</a> and <a class="el" href="class_q_c_p_layerable.html" title="Base class for all drawable objects. ">QCPLayerable</a>. <a class="el" href="class_q_custom_plot.html" title="The central class of the library. This is the QWidget which displays the plot and interacts with the ...">QCustomPlot</a> holds an ordered list of one or more instances of <a class="el" href="class_q_c_p_layer.html" title="A layer that may contain objects, to control the rendering order. ">QCPLayer</a> (see <a class="el" href="class_q_custom_plot.html#ad5255393df078448bb6ac83fa5db5f52">QCustomPlot::addLayer</a>, <a class="el" href="class_q_custom_plot.html#a0a96244e7773b242ef23c32b7bdfb159">QCustomPlot::layer</a>, <a class="el" href="class_q_custom_plot.html#ae896140beff19424e9e9e02d6e331104">QCustomPlot::moveLayer</a>, etc.). When replotting, <a class="el" href="class_q_custom_plot.html" title="The central class of the library. This is the QWidget which displays the plot and interacts with the ...">QCustomPlot</a> goes through the list of layers bottom to top and successively draws the layerables of the layers.</p>
<p>A <a class="el" href="class_q_c_p_layer.html" title="A layer that may contain objects, to control the rendering order. ">QCPLayer</a> contains an ordered list of <a class="el" href="class_q_c_p_layerable.html" title="Base class for all drawable objects. ">QCPLayerable</a> instances. <a class="el" href="class_q_c_p_layerable.html" title="Base class for all drawable objects. ">QCPLayerable</a> is an abstract base class from which almost all visible objects derive, like axes, grids, graphs, items, etc.</p>
<p>Initially, <a class="el" href="class_q_custom_plot.html" title="The central class of the library. This is the QWidget which displays the plot and interacts with the ...">QCustomPlot</a> has five layers: "background", "grid", "main", "axes" and "legend" (in that order). The top two layers "axes" and "legend" contain the default axes and legend, so they will be drawn on top. In the middle, there is the "main" layer. It is initially empty and set as the current layer (see <a class="el" href="class_q_custom_plot.html#a73a6dc47c653bb6f8f030abca5a11852">QCustomPlot::setCurrentLayer</a>). This means, all new plottables, items etc. are created on this layer by default. Then comes the "grid" layer which contains the <a class="el" href="class_q_c_p_grid.html" title="Responsible for drawing the grid of a QCPAxis. ">QCPGrid</a> instances (which belong tightly to <a class="el" href="class_q_c_p_axis.html" title="Manages a single axis inside a QCustomPlot. ">QCPAxis</a>, see <a class="el" href="class_q_c_p_axis.html#a63f1dd2df663680d2a8d06c19592dd63">QCPAxis::grid</a>). The Axis rect background shall be drawn behind everything else, thus the default <a class="el" href="class_q_c_p_axis_rect.html" title="Holds multiple axes and arranges them in a rectangular shape. ">QCPAxisRect</a> instance is placed on the "background" layer. Of course, the layer affiliation of the individual objects can be changed as required (<a class="el" href="class_q_c_p_layerable.html#ab0d0da6d2de45a118886d2c8e16d5a54">QCPLayerable::setLayer</a>).</p>
<p>Controlling the ordering of objects is easy: Create a new layer in the position you want it to be, e.g. above "main", with <a class="el" href="class_q_custom_plot.html#ad5255393df078448bb6ac83fa5db5f52">QCustomPlot::addLayer</a>. Then set the current layer with <a class="el" href="class_q_custom_plot.html#a73a6dc47c653bb6f8f030abca5a11852">QCustomPlot::setCurrentLayer</a> to that new layer and finally create the objects normally. They will be placed on the new layer automatically, due to the current layer setting. Alternatively you could have also ignored the current layer setting and just moved the objects with <a class="el" href="class_q_c_p_layerable.html#ab0d0da6d2de45a118886d2c8e16d5a54">QCPLayerable::setLayer</a> to the desired layer after creating them.</p>
<p>It is also possible to move whole layers. For example, If you want the grid to be shown in front of all plottables/items on the "main" layer, just move it above "main" with <a class="el" href="class_q_custom_plot.html#ae896140beff19424e9e9e02d6e331104">QCustomPlot::moveLayer</a>.</p>
<p>The rendering order within one layer is simply by order of creation or insertion. The item created last (or added last to the layer), is drawn on top of all other objects on that layer.</p>
<p>When a layer is deleted, the objects on it are not deleted with it, but fall on the layer below the deleted layer, see <a class="el" href="class_q_custom_plot.html#a40f75e342c5eaab6a86066a42a0e2a94">QCustomPlot::removeLayer</a>. </p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="a5d0657fc86d624e5efbe930ef21af718"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5d0657fc86d624e5efbe930ef21af718">&#9670;&nbsp;</a></span>QCPLayer()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">QCPLayer::QCPLayer </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="class_q_custom_plot.html">QCustomPlot</a> *&#160;</td>
          <td class="paramname"><em>parentPlot</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const QString &amp;&#160;</td>
          <td class="paramname"><em>layerName</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Creates a new <a class="el" href="class_q_c_p_layer.html" title="A layer that may contain objects, to control the rendering order. ">QCPLayer</a> instance.</p>
<p>Normally you shouldn't directly instantiate layers, use <a class="el" href="class_q_custom_plot.html#ad5255393df078448bb6ac83fa5db5f52">QCustomPlot::addLayer</a> instead.</p>
<dl class="section warning"><dt>Warning</dt><dd>It is not checked that <em>layerName</em> is actually a unique layer name in <em>parentPlot</em>. This check is only performed by <a class="el" href="class_q_custom_plot.html#ad5255393df078448bb6ac83fa5db5f52">QCustomPlot::addLayer</a>. </dd></dl>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a183b90941fc78f0b136edd77c5fb6966"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a183b90941fc78f0b136edd77c5fb6966">&#9670;&nbsp;</a></span>children()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">QList&lt; <a class="el" href="class_q_c_p_layerable.html">QCPLayerable</a> * &gt; QCPLayer::children </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Returns a list of all layerables on this layer. The order corresponds to the rendering order: layerables with higher indices are drawn above layerables with lower indices. </p>

</div>
</div>
<a id="ad322905c4700dcc7ceba63e011c730d2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad322905c4700dcc7ceba63e011c730d2">&#9670;&nbsp;</a></span>index()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">int QCPLayer::index </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Returns the index this layer has in the <a class="el" href="class_q_custom_plot.html" title="The central class of the library. This is the QWidget which displays the plot and interacts with the ...">QCustomPlot</a>. The index is the integer number by which this layer can be accessed via <a class="el" href="class_q_custom_plot.html#a0a96244e7773b242ef23c32b7bdfb159">QCustomPlot::layer</a>.</p>
<p>Layers with higher indices will be drawn above layers with lower indices. </p>

</div>
</div>
<a id="ac07671f74edf6884b51a82afb2c19516"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac07671f74edf6884b51a82afb2c19516">&#9670;&nbsp;</a></span>setVisible()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void QCPLayer::setVisible </td>
          <td>(</td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>visible</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Sets whether this layer is visible or not. If <em>visible</em> is set to false, all layerables on this layer will be invisible.</p>
<p>This function doesn't change the visibility property of the layerables (<a class="el" href="class_q_c_p_layerable.html#a3bed99ddc396b48ce3ebfdc0418744f8">QCPLayerable::setVisible</a>), but the <a class="el" href="class_q_c_p_layerable.html#ab054e88f15d485defcb95e7376f119e7">QCPLayerable::realVisibility</a> of each layerable takes the visibility of the parent layer into account. </p>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>R:/Develop/a0-develop/LibQQt/src/charts/qcustomplot/<a class="el" href="qcustomplot_8h_source.html">qcustomplot.h</a></li>
<li>R:/Develop/a0-develop/LibQQt/src/charts/qcustomplot/<a class="el" href="qcustomplot_8cpp.html">qcustomplot.cpp</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.14
</small></address>
</body>
</html>
